<?php
 
namespace app\api\controller;
 
use think\Controller;
use Request;
 
class Token extends Controller
{
	private $token = "tmd123456";
    /**
     * 显示资源列表
     *
     * @return \think\Response
     */
    public function check()
    {
        $signature = Request::param('signature');
        $timestamp = Request::param('timestamp');
        $nonce = Request::param('nonce');
        $echostr = Request::param('echostr');
        // Log::write("=====>>signnature : " .$signnature);
        // Log::write("=====>>timestamp : " .$timestamp);
        // Log::write("=====>>nonce : " .$nonce);
        // Log::write("=====>>echostr : " .$echostr);
        // 根据字典序排序
        $arrayName = array($timestamp,$nonce,$this->token);
        // 转化为字符串
        $temp = implode($arrayName);
        // 对字符串尽心加密
        $temp = sha1($temp);
        if($temp == $signature){
        	echo $echostr;
        }
    }
 
   
}